	var last_menu;
	var cur_menu ;
	var clickedMenuID;
	var clickedSubmenuID;
	var prevClickedSubmenuID;
	var showdiv;
	var obj_timeout;
	var flag=true;

function openURL(url)
{
if(url)
{
  document.getElementById('mainframe').src=url;
}
}
	function cleartimeout(){
		clearTimeout(obj_timeout);
		flag=true;
		
	}
	function showMenuDelay(div,delayTime){
	    
	    showdiv = div;
		flag = false;
		obj_timeout = setTimeout("displayMenu()",delayTime);
		
	}
	
	function displayMenu(){

		if(flag){
			return false;
		}
		var div = showdiv;
		cur_menu = div;
		var m_div = document.getElementById(div);
		var hid_space = GetObjPos(m_div);
		
		var l_img = document.getElementById("img_"+last_menu);
		var l_link = document.getElementById("link_"+last_menu);
		var l_sub = document.getElementById("sub_"+last_menu);
		var l_hid = document.getElementById("hid_"+last_menu);
		if(l_sub&&last_menu!=cur_menu){
			l_img.style.display = 'none';
			l_link.className ="w_temp";
			l_sub.style.display = 'none';
			l_hid.style.display = 'none';
		}
		
		var m_img = document.getElementById("img_"+div);
		var m_link = document.getElementById("link_"+div);
		var m_sub = document.getElementById("sub_"+div);
		var m_hid = document.getElementById("hid_"+div);
		
		m_img.style.display = 'block';
		m_link.className ="b_temp";
		m_sub.style.display = 'block';
		
 
 		var sub_width = m_sub.clientWidth;
		var body_width = document.body.offsetWidth;
		
		if((hid_space.x+sub_width)>(body_width-100)){
			m_hid.style.width = body_width -100-sub_width ;
		}else{
			m_hid.style.width = hid_space.x;
		}
		m_hid.style.display = 'block';
		
		last_menu = div;
	
	}
	function clickSubMenu(submenuid,submenurl){
		clickedMenuID = cur_menu;
		prevClickedSubmenuID=clickedSubmenuID;
		 clickedSubmenuID=submenuid;
		 openURL(submenurl);
	}
	function changSubMenuSytle(submenuid){
	 var curSubMenu = document.getElementById(submenuid);
	     if(prevClickedSubmenuID)
	     {
	     var prevSubMenu = document.getElementById(prevClickedSubmenuID);
	     prevSubMenu.className="submenu";
	     }
	     if(submenuid==clickedSubmenuID)
	      {
		  curSubMenu.className="submenu_clicked";
	      }else
	      {
	      curSubMenu.className="submenu";
	      }
	}
	
	function reFocusClickedMenu(){
	if(clickedMenuID){
		showMenuDelay(clickedMenuID,1000);
		}
	}

	
function CPos(x, y)
{
    this.x = x;
    this.y = y;
}

function GetObjPos(ATarget)
{
    var target = ATarget;
    var pos = new CPos(target.offsetLeft, target.offsetTop);
    
    var target = target.offsetParent;
    while (target)
    {
        pos.x += target.offsetLeft;
        pos.y += target.offsetTop;
        
        target = target.offsetParent
    }
    
    return pos;
}